﻿@*use this for the fake AjaxOptions since ajax helpers were dropped in .net core*@
@model IPagedList<string>
    
@*import this so we get our HTML Helper*@
@using X.PagedList.Mvc.Core; 

@*import this so we can cast our list to IPagedList (only necessary because ViewBag is dynamic)*@
@using X.PagedList;

<ul>
    @foreach (var name in Model)
    {
        <li>@name</li>
    }
</ul>

@Html.PagedListPager(
    (IPagedList<string>)ViewBag.Names, 
    page => Url.Action("GetOnePageOfNames", new { page }), 
    PagedListRenderOptions.EnableUnobtrusiveAjaxReplacing(
        new PagedListRenderOptions
        {
            MaximumPageNumbersToDisplay = 5,
            DisplayPageCountAndCurrentLocation = true,
            UlElementClasses = new[] { "pagination" },
            ContainerDivClasses = new[] { "pagination-container" }
        },
        new AjaxOptions()
        {
            HttpMethod = "GET",
            UpdateTargetId = "nameListContainer"
        })
    )
